﻿using StarPizza.Model.BaseModel;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace StarPizza
{
    public static class Utility
    {
        public static bool TrySubmitChanges(StarDataDataContext db)
        {
            try
            {
                db.SubmitChanges();
            }
            catch (Exception)
            {
                //todo log
                return false;   
            }
            return true;
        }
        public static void AddItems<T>(this ObservableCollection<T> thisCollection, IEnumerable<T> items)
        {
            foreach (var item in items)
            {
                thisCollection.Add(item);
            }
        }
    }
}
